package com.raitcon.hibernate.bean;
// Generated 09/08/2014 12:26:17 PM by Hibernate Tools 3.2.1.GA


import java.util.HashSet;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;

/**
 * Libreta generated by hbm2java
 */
@Entity
@Table(name="libreta"
    ,schema="public"
)
public class Libreta  implements java.io.Serializable {


     private int idLibreta;
     private Anio anio;
     private Grado grado;
     private String comentarios;
     private Set<DetalleLibreta> detalleLibretas = new HashSet<DetalleLibreta>(0);

    public Libreta() {
    }

	
    public Libreta(int idLibreta, Anio anio) {
        this.idLibreta = idLibreta;
        this.anio = anio;
    }
    public Libreta(int idLibreta, Anio anio, Grado grado, String comentarios, Set<DetalleLibreta> detalleLibretas) {
       this.idLibreta = idLibreta;
       this.anio = anio;
       this.grado = grado;
       this.comentarios = comentarios;
       this.detalleLibretas = detalleLibretas;
    }
     @SequenceGenerator(allocationSize=1, initialValue=1, sequenceName="secuencia_id_libreta", name="secuencia_id_libreta")
     @GeneratedValue(generator="secuencia_id_libreta", strategy=GenerationType.SEQUENCE)
     @Id 
    
    @Column(name="id_libreta", unique=true, nullable=false)
    public int getIdLibreta() {
        return this.idLibreta;
    }
    
    public void setIdLibreta(int idLibreta) {
        this.idLibreta = idLibreta;
    }
@ManyToOne(fetch=FetchType.LAZY)
    @JoinColumn(name="id_anio", nullable=false)
    public Anio getAnio() {
        return this.anio;
    }
    
    public void setAnio(Anio anio) {
        this.anio = anio;
    }
@ManyToOne(fetch=FetchType.LAZY)
    @JoinColumn(name="id_grado")
    public Grado getGrado() {
        return this.grado;
    }
    
    public void setGrado(Grado grado) {
        this.grado = grado;
    }
    
    @Column(name="comentarios", length=120)
    public String getComentarios() {
        return this.comentarios;
    }
    
    public void setComentarios(String comentarios) {
        this.comentarios = comentarios;
    }
@OneToMany(cascade=CascadeType.ALL, fetch=FetchType.EAGER, mappedBy="libreta")
    public Set<DetalleLibreta> getDetalleLibretas() {
        return this.detalleLibretas;
    }
    
    public void setDetalleLibretas(Set<DetalleLibreta> detalleLibretas) {
        this.detalleLibretas = detalleLibretas;
    }




}


